<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>小区物业管理系统-业主注册</title>

<meta
	content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"
	name="viewport">

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/ionicons/css/ionicons.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/adminLTE/css/AdminLTE.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/iCheck/square/blue.css">
</head>

<body class="hold-transition register-page">
<div class="register-box">
	<div class="register-logo">
		<a href="#">密码修改页面</a>
	</div>

	<div class="register-box-body">
		<p class="login-box-msg">修改密码</p>

		<form id="subform" action="${pageContext.request.contextPath}/user/updatepwd.do?userid=${user.userid}" method="post">
			<div class="form-group has-feedback">
				<input id="old" type="text" class="form-control" placeholder="请输入旧密码">
			</div>
			<div class="form-group has-feedback">
				<input id="pwd" type="password" class="form-control" placeholder="请输入新密码" name="userpwd">
			</div>
			<div class="form-group has-feedback">
				<input id="repwd" type="password" class="form-control" placeholder="重复输入新密码">
			</div>
			<span id="tips" style="color:red;font-size: small"></span>
		</form>
			<button id="dosubmit" class="btn btn-primary btn-block btn-flat" onclick="check()">修改密码</button>
	</div>
	<!-- /.form-box -->
</div>
<!-- /.register-box -->

<!-- jQuery 3 -->
<script src="../../bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="../../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="../../plugins/iCheck/icheck.min.js"></script>
<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' /* optional */
        });
    });
	function check() {
	    var old = document.getElementById("old").value;
        var checkold = ${user.userpwd};
        var pwd = document.getElementById("pwd").value;
        var repwd = document.getElementById("repwd").value;

		if(pwd=="")document.getElementById("tips").innerHTML="密码不能为空！";
        else if(repwd=="")document.getElementById("tips").innerHTML="密码不能为空！";

        else{
            if(old!=checkold)document.getElementById("tips").innerHTML="旧密码输入错误，请重新输入！";
            else if(pwd!=repwd)document.getElementById("tips").innerHTML="两次密码输入不一致，请重新输入！";
            else {alert("修改成功，请重新登录！");document.getElementById("subform").submit();}
            }
		}
</script>
</body>

</html>